package com.dzirtbry.MedicineAnalizer.Types;

import java.io.Serializable;

public class Medicine implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4211689286451939594L;
	private String name;
	private int id;
	private double price;
	
	public void setName(String name) {
		this.name = name;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	public Medicine(String name, int id, double price) {
		this.name = name;
		this.id = id;
		this.price = price;
	}
	
	public Medicine(String name, int id) {
		this.name = name;
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public int getId() {
		return id;
	}
	
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
           return true;
       if (obj == null)
           return false;
       if (getClass() != obj.getClass())
           return false;
		Medicine med = (Medicine) obj;
		return ((med.getId() == this.id) && med.getName().equals(this.name));
	}
	
	@Override
	public String toString() {
		return String.format("[%d, %s, %.2f]", id, name, price);
	}
	
}
